/*!
 * SPDX-License-Identifier: Apache-2.0
 *
 * The OpenSearch Contributors require contributions made to
 * this file be licensed under the Apache-2.0 license or a
 * compatible open source license.
 *
 * Modifications Copyright OpenSearch Contributors. See
 * GitHub history for details.
 */

$ouiLinkColors: (
  subdued: $ouiTextSubduedColor,
  primary: $ouiColorPrimaryText,
  secondary: $ouiColorSecondaryText,
  success: $ouiColorSuccessText,
  accent: $ouiColorAccentText,
  warning: $ouiColorWarningText,
  danger: $ouiColorDangerText,
  text: $ouiTextColor,
  ghost: $ouiColorGhost,
);

.ouiLink {
  @include ouiLink;

  .ouiLink__externalIcon {
    margin-left: $ouiSizeXS;
  }

  &.ouiLink-disabled {
    text-decoration: none;
    cursor: default;
  }

  // Create color modifiers based on the map
  @each $name, $color in $ouiLinkColors {
    &.ouiLink--#{$name} {
      color: $color;

      &:hover,
      &:focus {
        color: darken($color, 10%);
        text-decoration: underline;
      }

      &:focus {
        @include ouiFocusBackground($color);
        @include ouiFocusRing(null);
      }
    }
  }
}

// Make button OuiLink's text selectable
button.ouiLink { // sass-lint:disable-line no-qualifying-elements
  user-select: text;
}


/* OUI -> EUI Aliases */
$euiLinkColors: $ouiLinkColors;
/* End of Aliases */
